<?php // no direct access
    defined('_JEXEC') or die('Restricted access'); 

    $lang =& JFactory::getLanguage();
    $template_dir = $this->baseurl.'/templates/mwc_careitec/assets/';
    jimport('mylibs.function');
    jimport('mylibs.globalModel');
    $globalModel = new globalModel();
?>     

<link type="text/css" rel="stylesheet" href="<?php echo $template_dir; ?>css/screen/nivo-slider.css" />
<script type="text/javascript" src="<?php echo $template_dir; ?>scripts/jquery.nivo.slider.js"></script>
<script type="text/javascript" src="<?php echo $template_dir; ?>scripts/jcarousellite_1.0.1c4.js"></script>        
<script type="text/javascript">
    jQuery(window).load(function() {    
        jQuery('#default_slider').nivoSlider({
            effect: 'sliceDown',    //Specify sets like: 'fold,fade,sliceDown'
            slices: 15

        });
    });
</script>

<div id="main">
    <div id="container" class="w950">           
        <div id="slideshow" style="height:270px; position:relative;">
            <?php 
            $array_block = array("news_block", "tutorials_block", "links_block");
            $array_li = array("news_li", "tutorials_li", "links_li");

            $arr_data = $globalModel->getHomepageBanners();//-- 1:news 
            $i = 0;	
            $ul_tab = '';	 
            $display = 'none';     
            foreach ( $arr_data as $key=>$value ){
                $params = new JParameter($value['attribs']);
                $m = $params->get('link_type', 0); 
                $link_type = ($m != 'internal') ? 'target="_blank"' : '';
                ?>	 
                <!--            
                <div id="<?php echo $array_block[$i]; ?>" class="content"  style="background:url(<?php echo $value['article_image'];?>) no-repeat; display: <?php echo $display; ?>; width:950px; height:270px; padding:0; margin:0; top:0; position: absolute;">
                    <div class="txt_info">
                        <a href="#"><?php echo $value['introtext'];?></a>
                    </div>  
                </div>
                -->
                <div id="<?php echo $array_block[$i]; ?>" class="content"  style="display: <?php echo $display; ?>;">
                    <a href="<?php echo $params->get('slide_link', '#'); ?>" <?php echo $link_type; ?> style="width:950px; height:270px; padding:0; margin:0; top:0; position: absolute;">
                        <img src="<?php echo $value['article_image'];?>" />                        
                    </a>
                    <div class="txt_info">                        
                        <?php echo $value['introtext'];?>
                    </div>  
                </div>
                <?php
                if($i==0) {
                    $ul_tab.='<li id="'.$array_li[$i].'" class="m2r"><a href="#" id="'.$i.'">'.$value['title'].'</a></li>';
                }
                elseif ($i==1){
                    $ul_tab.='<li id="'.$array_li[$i].'" class="m2r"><a href="#" id="'.$i.'">'.$value['title'].'</a></li>';
                }
                else{
                    $ul_tab.='<li id="'.$array_li[$i].'"><a href="#" id="'.$i.'">'.$value['title'].'</a></li>';
                }
                $i++;
            } 
            ?> 
            
            <div id="default_block" class="content" style="width:950px; height:270px; padding:0; margin:0; top:0; position:absolute;">
                <div id="default_slider">
                    <?php 
                    /*
                    $exts = array('jpg', 'jpeg', 'png', 'gif');
                    $files = JFolder::files('images/rokquickcart/Gallery/Slider/');
                    foreach($files as $item){
                        if(in_array(JFile::getExt($item), $exts)){
                    */
                    print_r($items);
                    $items = $globalModel->getHomepageBannersDefault();     
                    foreach($items as $item){
                        $params = new JParameter($item['attribs']);                        
                        $m = $params->get('link_type', 0); 
                        $link_type = ($m != 'internal') ? 'target="_blank"' : '';
                        $link = $params->get('slide_link', '#'); 
                        
                    ?>
                       <!-- <img src="images/rokquickcart/Gallery/Slider/<?php //echo $item; ?>" width="950" height="270" />  -->
                       <a href="<?php echo $link; ?>" <?php echo $link_type; ?>><img src="<?php echo $item['article_image']; ?>" width="950" height="270" /></a>
                       
                    <?php } ?>  
                </div>
            </div>
        </div>
        
        <ul class="menutab" style="margin-top:5px">
            <?php echo $ul_tab; ?>
        </ul>
        <div class="cl"></div>  
    </div>
    
    <div class="w950 mc p5t">
        <div class="w315 float_left m5r">
            <div class="w315_top"></div>
            <div class="w315_mid1">
                <div class="w285 mc p5b p10t">
                    <h2 class="b1pxb"><?php echo JText::_('LATEST_NEWS');?></h2>
                    {module Latest News}
                </div>                 	 
                <div class="w285 mc p5b">
                    <div class="w285 float_left m2r bg_top_ny">
                        <h2 class="p10t"><?php echo JText::_('Newsletter');?></h2>
                        <p class="p20t p5b"><?php echo JText::_('NEWSLETTER_DESC');?>:</p>
                        <div class="txt_ny_bg">
                            <script language="javascript" type="text/javascript">
                                function submitacajoommod1(formname){
                                    var form = eval('document.'+formname);var place = form.email.value.indexOf("@",1);
                                    var point = form.email.value.indexOf(".",place+1); 
                                    if (form.email.value == ""){
                                        show_popup('<?php echo JText::_( 'EMAIL_ERROR' ); ?>','email');
                                        return false;
                                    } 
                                    else 
                                        {
                                        if ((place > -1)&&(form.email.value.length >2)&&(point > 1))
                                            {
                                            form.submit();return true;
                                        } 
                                        else 
                                            {
                                            show_popup('<?php echo JText::_( 'EMAIL_ERROR' ); ?>','email');
                                            return false;
                                        }
                                    }
                                }
                            </script>
                            <form name="modacajoomForm1" method="post" action="index.php?option=com_acajoom">
                                <input type="hidden" name="subscribed[1]" value="1">
                                <input type="hidden" value="1" name="sub_list_id[1]"><input type="text" name="email" id="email" class="txt_ny" id="wz_12">
                                <input style="display:none" type="button" onclick="return submitacajoommod1('modacajoomForm1');" name="Subscribe" class="button" value="Subscribe" id="aca_22">

                                <input type="hidden" value="subscribe" name="act">
                                <input type="hidden" value="" name="redirectlink">
                                <input type="hidden" value="1" name="listname"><input type="hidden" value="PaTcQBUTllokM" name="passwordA"><input type="hidden" value="1" name="fromSubscribe"><input type="hidden" value="999" name="Itemid"><input type="hidden" value="PaTcQBUTllokM" name="passwordA"><input type="hidden" value="1" name="fromSubscribe"><input type="hidden" name="receive_html" value="1" id="wz_2">
                                <input type="hidden" value="PaTcQBUTllokM" name="passwordA">
                                <input type="hidden" value="1" name="fromSubscribe">
                            </form>
                        </div>
                        <img style="cursor:pointer" onclick="jQuery('#aca_22').trigger('click')" src="<?php echo $template_dir; ?>images/til_but.jpg" alt="" />
                        <img  style="cursor:pointer" onclick="document.modacajoomForm1.reset();return false;" src="<?php echo $template_dir; ?>images/af_but.jpg" alt="" />
                           
                        <!--{ modu le Acajoom Subscriber Module } -->
                    </div>
                </div>  
            </div>
            <div class="w315_bot"></div>
        </div>
        <div class="w635 float_right">             
            <?php 
            $arr_data = $globalModel->get4Boxes();
            $k = 0;
            $z = 1;
            foreach ( $arr_data as $key => $value ){		      
                $parametar = new JParameter($value['attribs']);
                $m = $parametar->get('link_type', 0); 
                $link_type = ($m != 'internal') ? 'target="_blank"' : '';
                $m5r = ($k % 2 == 0) ? ' m5r' : '';
                $m5b = ($z == 1) ? ' m5b' : '';
                //$link = 'index.php?option=com_content&view=article&layout=articlehome&id=' . $value['id']; 
                $link = $parametar->get('slide_link', '#'); 
                ?>
                <?php if($z == 1 || $z == 3){ ?>
                    <div class="w635<?php echo $m5b; ?>">
                <?php } ?>
                    <div class="w315 float_left<?php echo $m5r; ?>">                    
                        <a href="<?php echo $link; ?>" <?php echo $link_type; ?>><img src="<?php echo $value['article_image']; ?>" alt="<?php echo $value['title']; ?>" width="313" height="180" /></a>
                    </div>    
                    <?php if($k % 2 != 0){ ?>
                        <div class="cl"></div>
                    <?php } ?>
                <?php if($z == 2 || $z == 4){ ?>
                    </div>   
                <?php
                }
                $k++;
                $z++;      
            } 
            ?>               
        </div>
        <br style="clear:both; font-size:0px; line-height:0px; height:0px;" />
    </div> 
</div>
<div class="p5t">
    <div class="sponser">
        <div class="w950 mc p2t">
            <div class="w315 bg_kon float_left">
                <div class="w275 mc">
                    <div class="w144 float_left p15t">
                        <h2><?php echo JText::_('CONTACT_US'); ?></h2>
                        <p class="p15t" style="line-height:20px;">Careitec A/S Langballe 2<br/>
                            8700 Horsens<br/>
                            Tlf: 70101112 <br/>
                            <a href="mailto:info@careitec.dk">info@careitec.dk</a></p>
                    </div>
                    <div class="w118 float_right p5t"><img src="<?php echo $template_dir; ?>images/map.png" alt="" width="118" height="137" /></div>
                    <div class="cb"></div>
                </div>
            </div>
            <div class="w630 bg_sponer float_right">
                <h2 class="p10t p15b"><?php echo JText::_('CUSTOMER_REF'); ?></h2>
                <div class="w630">
                    <div class="icon_click float_left"><a href="javascript:void(0);" class="next"><img src="<?php echo $template_dir; ?>images/back.png" alt="" /></a></div>
                    <div class="w570 float_left" id="mycarousel">
                        <ul class="list_img1">
                            <?php                    
                                $arr_data_cr = $globalModel->getMWCBanners(); 
                                foreach ( $arr_data_cr as $key=>$value ){		                    	           	      	             	                         	
                                ?>	
                                    <li>
                                        <a href="<?php echo $value['link'];?>" target="_blank"><img src="<?php echo str_replace("../", "", $value['thumbnail']);?>" alt="" /></a>
                                    </li>
                                <?php
                                } 
                            ?>
                        </ul>
                    </div>
                    <div class="icon_click float_right"><a href="javascript:void(0);" class="prev"><img src="<?php echo $template_dir; ?>images/next.png" alt="" /></a></div>
                    <div class="cb"></div>
                </div>
            </div>
            <div class="cb"></div>
        </div>
    </div>
</div>

<div id="footer">
<!--
    <embed src="<?php echo $this->baseurl; ?>/media/music/lydlogo_forside_web_1min6sek.mp3" autostart="true" loop="false" hidden="true" volume="10"> </embed>
-->	
    <div class="w950 mc p15t p15b">
        <p class="float_left">Copyright © 2010 <a href="<?php echo $this->baseurl; ?>">CAREITEC.DK</a>. All rights reserved.</p>
        <p class="float_right">Design by <a href="http://www.mywebcreations.dk/" target="_blank">My Web Creations</a></p>
        <br style="clear:both" />
    </div>
    </div>
  </div>
</div>

<script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery("#mycarousel").jCarouselLite({
            btnNext: ".icon_click .next",
            btnPrev: ".icon_click .prev",
            visible : 4,
            scroll: 1,
            speed : 400,
            //circular: false,
            start: 0,     
            size: <?php echo count($arr_data_cr); ?>,            
            beforeStart: function(){
                //jQuery(".icon_click .prev").hide();  
            },
            afterEnd: function() {
                //jQuery(".icon_click .next").hide();
            }
        });    

    });    
</script>